<?php
use yii\helpers\Url;
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\CategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */



$this->title = 'Categories';
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="ibox float-e-margins" id="bx_search_form">
    <div class="ibox-title">
      <?php echo \backend\widgets\ActionMenuWidget::widget(['attr'=>[['title'=>'测试','href'=>'ceshi','btn_css'=>'btn-primary','btn_id_type'=>'BX_action_ids']]]); ?>
      <div class="ibox-tools">
        <a class="collapse-link">
          搜索
          <i class="fa fa-chevron-down"></i>
        </a>
      </div>
    </div>
    <div class="ibox-content" style="display: none">
      <?php echo $this->render('_search', ['model' => $searchModel]); ?>
    </div>
</div>

<div class="ibox-content">
    <?= GridView::widget([
      //'tableOptions'=> ['class'=>'table table-border table-bordered'],'style'=>'overflow:auto'
      'options' => ['class' => 'grid-view','id' => 'grid'],
      'dataProvider' => $dataProvider,
      'filterModel' => $searchModel,
      'columns' => [
        //['class' => 'yii\grid\SerialColumn'],
        [
          'class' => 'yii\grid\CheckboxColumn',
          'multiple'=> true,
          //'cssClass'=>'t',
          'name' => 'grid',
          'checkboxOptions'=>['class'=>'grid']
        ],

        'id',
        'p_id',
        //'title',
        [
          'attribute' => 'title',
          'format'=>'raw',
          'value'=> function($model){
            return "<a href='javascript:;' class='edit_title editable editable-click' data-type='text' data-pk='{$model->id}' data-title='Enter username'  data-name='title' >{$model->title}</a>";
          }
        ],
        'created_at:datetime',
        'updated_at:datetime',
        //'deleted',
        // ['class' => 'yii\grid\ActionColumn'],
      ],
    ]);











    ?>

</div>

<?php \common\widgets\JsBlock::begin(); ?>

<script type="text/javascript">
<?php //$this->beginBlock('yourBlockID') ?>

$('.edit_title').editable({
  url: '/post',
  mode: "inline",              //编辑框的模式：支持popup和inline两种模式，默认是popup
  validate: function (value) { //字段验证
    if (!$.trim(value)) {
      return '不能为空';
    }
  }
});
<?php //$this->endBlock() ?>
</script>

<?php \common\widgets\JsBlock::end(); ?>





<?php //$this->registerJs($this->blocks['yourBlockID'], \yii\web\View::POS_READY); ?>